#include <stdio.h>
int main(){
    int n,result,level;
    int change[3][3]={{-10,0,10},{-5,0,15},{-15,0,5}};
    int score=-160;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d%d",&result,&level);
        result++;
        if(level>0){
            level=2;   
        }else if(level<0){
            level=1;
        }
        score+=change[level][result];
    }
    printf("%d",score);
    return 0;
}